Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 7 - View-Related Objects / About Drawing, Coordinate Conversion, and Clipping


Local Space

Local space defines the location and dimensions of a shape after it has been modified by the mapping property of its associated transform object. Because mappings can translate, scale, rotate, skew, and otherwise distort geometries, the dimensions of a shape in local space can be quite different from what they are in geometry space.

As the first stage of drawing a shape, QuickDraw GX modifies the shape's geometry by applying information from the style object attached to the shape, and then applying first the clip and then the mapping contained in the transform object attached to the shape. Applying the mapping converts the shape from geometry space to local space. Because the transform clip is applied before the transform mapping, the dimensions of the clip shape are considered to be in geometry space. When you define the clip of a transform object, you size it and position it in terms of the dimensions of the shape's geometry.

The left side of Figure 7-15 shows the same vase shape as in Figure 7-14, this time after the transform clip has been applied to it. At this point the shape is still in geometry space--its overall position and dimensions unchanged, but its appearance modified by the clip.

Figure 7-15 Applying the transform's clip and mapping to a shape

The right side of Figure 7-15 shows the vase shape after the transform mapping has been applied to it. In this particular example, the only effect of the transform mapping is to scale the shape by a factor of 2.0 in the vertical direction, about an origin at (0.0, 0.0) in geometry space. The vase is now in local space.

Local space, like geometry space, has no metric; the absolute size of a shape object is still undefined after the transform mapping has been applied. You can, however, compare the sizes of two shape objects that share the same transform object. For example, if two path shapes have the same geometry and reference the same transform object, they are the same size.

You typically use the transform's clip and mapping for application-specific purposes related to moving, masking, and distorting shapes within a document. With the transform clip you define what parts of the shape geometry are to be visible, and with the transform mapping you choose how to move, orient, and distort that visible part of the shape, usually in relation to other shapes in the same document.

Several shape objects can reference the same transform object. This allows you to move, scale, rotate, and otherwise change an entire group of shapes in unison, by altering a single transform mapping.

Some shape types have specific additional definitions of local space:

The transform object includes a reference to at least one view port object, and local space orients a shape within its view port. Local space is the coordinate system local to that view port--hence its name. Thus, the vase example in this section would have the same local coordinates--its bounding rectangle would have corners at about (0.0, 0.0) and (100.0, 200.0)--no matter how the view port itself might be scaled or distorted by its own mapping when it is converted to global space.

The fact that local space is the interior coordinate space of a view port means that you can compare the sizes of two shapes in local space even if they do not share the same transform--as long as they share the same view port. If two shapes have the same dimensions in local space and their transforms reference the same view port, they are the same size regardless of the actual values in their geometries or transform mappings.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996